home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
citydemo
/
c4i_wins.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
4KB
|
153 lines
#ifndef lint
static char SccsId[]= "@(#)c4i_wins.c V1.13 3/13/95";
#endif
/*------------------------------------------------------------------
| file name -- c4i_wins.c
|
| functions Description
| --------- -----------
| OpenWindow Opens and displays the window.
| CloseWin Closes the window.
| CleanupWindow Cleans up the window views and drawports.
|-----------------------------------------------------------------*/
#include "std.h"
#include "dvstd.h"
#include "dvtools.h"
#include "VOstd.h"
#include "Tfundecl.h"
#include "c4i_vars.h"
#include "c4i_fundecl.h"
/*-----------------------------------------------------------------
|
| OpenWindow
| Performs the initialization needed for the opeing a window.
|
| If the window is already visible return. Otherwise, create
| a window and display the appropriate view.
|
*/
OBJECT
OpenWindow (window_id)
int window_id;
{
OBJECT screen = 0;
int error_code;
char buf[50];
/* Only open the window if its not already opened. */
if (!DVscreen[window_id])
{
/* Create the window */
if (WindowSize[window_id].x == -1)
/* use the default window size */
screen = TscOpenSet (DeviceName, (CHAR *) NULL,
V_WINDOW_X, WindowPos[window_id].x,
V_WINDOW_Y, WindowPos[window_id].y,
V_WINDOW_NAME, WindowName[window_id],
#ifdef WINNT
V_WIN32_ICON_NAME, "cityicon",
#ifdef DOUBLE_BUFFER
V_WIN32_DOUBLE_BUFFER, YES,
#endif /* DOUBLE_BUFFER */
#else /* Not WINNT */
V_X_EXPOSURE_BLOCK,YES,
#endif /* WINNT */
V_INITIAL_CURSOR,
V_END_OF_LIST);
else
screen = TscOpenSet (DeviceName, (CHAR *) NULL,
V_WINDOW_WIDTH, WindowSize[window_id].x,
V_WINDOW_HEIGHT, WindowSize[window_id].y,
V_WINDOW_X, WindowPos[window_id].x,
V_WINDOW_Y, WindowPos[window_id].y,
V_WINDOW_NAME, WindowName[window_id],
#ifdef WINNT
V_WIN32_ICON_NAME, "cityicon",
#ifdef DOUBLE_BUFFER
V_WIN32_DOUBLE_BUFFER, YES,
#endif /* DOUBLE_BUFFER */
#else /* Not WINNT */
V_X_EXPOSURE_BLOCK,YES,
#endif /* WINNT */
V_INITIAL_CURSOR,
V_END_OF_LIST);
if(!screen)
{
error_code=TscOpenError();
#ifdef WINNT
sprintf(buf,"Product is not validated. Error code %d.",error_code);
MessageBox(NULL,buf,"Validation Error",MB_OK);
#else
fprintf(stderr,"Product is not validated. Error code %d.",error_code);
#endif
exit(error_code);
}
/* Erase the "copyright" message and set the cursor */
(VOID) TscErase (screen);
/* Setup generic service functions for common events */
InitSimpleEvents ();
/* Keep a handle to the just opened screen */
DVscreen[window_id] = screen;
}
return screen;
} /* END OpenWindow */
/*-----------------------------------------------------------------
|
| CloseWin
| Closes the window and destoys its drawport
*/
void
CloseWin (window_id)
int window_id;
{
/* Drawports should've been destroyed with DP-Table. */
/* Close the screen */
(VOID) TscClose (DVscreen[window_id]);
DVscreen[window_id] = 0;
}
/*-----------------------------------------------------------------
|
| CleanupWindow
| Cleans up Drawports, Viewports, and closes Screens.
*/
void
CleanupWindow (window_id)
int window_id;
{
/* Close the window if its open */
if (DVscreen[window_id])
{
/* Set the current screen */
(VOID) TscSetCurrentScreen (DVscreen[window_id]);
/* Erase and Close the window */
CloseWin( window_id );
}
}